/**
 * Created by hxsd on 2016/7/21.
 */

$(function(){
    $(".gift_list:eq(0)").css({"marginRight":"-100px"});
    $(".gift_list:eq(1)").css({"marginLeft":"-100px"});
    $(".gift_list:eq(2)").css({"marginRight":"-100px"});
    $(document).scroll(function(){
        if($(window).scrollTop()>200){
            $(".gift_list:eq(0)").animate({
                opacity:1,
                filter:"Alpha(opacity=100)",
                marginRight:"0"
            },1000);
        }
        if($(window).scrollTop()>500){
            $(".gift_list:eq(1)").animate({
                opacity:1,
                filter:"Alpha(opacity=100)",
                marginLeft:"0"
            },1000);
        }
        if($(window).scrollTop()>800){
            $(".gift_list:eq(2)").animate({
                opacity:1,
                filter:"Alpha(opacity=100)",
                marginRight:"0"
            },1000);
        }
    });
    $(".textList li:eq(1)").on("click",function(){
        $(".main").css("background","url('images/breakfastBg_03.png')");
        $(".gift").css("display","none");
        $(".breakfast").css("display","block");
        $(".breakfast_list").each(function(index){
            var x=$(this);
            setTimeout(function(){
                x.animate({
                    opacity:1,
                    filter:"Alpha(opacity=100)",
                    marginTop:"0"
                },800)
            },800*(index+1))
        });
        $(".textList li:eq(1) a").addClass("active");
        $(".textList li:eq(0) a").removeClass("active");
    });
    $(".textList li:eq(0)").on("click",function(){
        $(".main").css("background","");
        $(".gift").css("display","block");
        $(".breakfast").css("display","none");
        $(".textList li:eq(0) a").addClass("active");
        $(".textList li:eq(1) a").removeClass("active");
    });
});
